﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _14_ObserverDelegate
{
    interface Subject
    {
        void Notify();
        string SubjectState { get; set; }
    }

    class Boos : Subject
    {
        public Action Update;

        private string action;

        public string SubjectState { get; set; }

        public void Notify()
        {
            Update();
        }
    }

    class StockObserver
    {
        private string name;
        private Subject sub;

        public StockObserver(string name, Subject sub)
        {
            this.name = name;
            this.sub = sub;
        }

        public void CloseStockSeeding()
        {
            Console.WriteLine("{0} {1} 关闭股票，继续工作!",sub.SubjectState,name);
        }
    }
    class NBAbserver
    {
        private string name;
        private Subject sub;

        public NBAbserver(string name, Subject sub)
        {
            this.name = name;
            this.sub = sub;
        }

        public void CloseNBADirectSeeding()
        {
            Console.WriteLine("{0} {1} 关闭NBA 直播，继续工作!", sub.SubjectState, name);
        }
    }
}
